const formUtil = {
  checkEmail(email) {
    let re = new RegExp(/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,5}$/);
    if (!re.test(email)) {
      return false;
    } else {
      return true;
    }
  },
  checkMobile(mobile){
    let re = new RegExp(/^1[3456789]\d{9}$/);
    if (!re.test(mobile)) {
      return false;
    } else {
      return true;
    }
  },
  checkCode(code) {
    let re = new RegExp(/^\d{4}$/);
    if (!re.test(code)) {
      return false;
    } else {
      return true;
    }
  },
  checkPassword(password) {
    let re = new RegExp(/^[a-zA-Z0-9_-]{6,18}$/)
    if (!re.test(password)) {
      return false;
    } else {
      return true;
    }
  }
}
module.exports = formUtil;